I am learning to use KFLOP and KSTEP, and I found that I only make the stepper motors move once with the SimpleCoordMotion example.
I only changed the values for the motor setting, which are highlighted. With that change, the system only worked once.
Thanks.
int main(int argc, char* argv[])
{
KM = new CKMotionDLL(0); // create as board 0
CM = new CCoordMotion(KM);
int ctpin=10000;
double vel=0.1;
double accl=4.0;
MOTION_PARAMS *p=CM->GetMotionParams();
p->BreakAngle = 30;
p->MaxAccelX = accl;
p->MaxAccelY = accl;
p->MaxAccelZ =
accl;
p->MaxAccelA = accl;
p->MaxAccelB = accl;
p->MaxAccelC = accl;
p->MaxVelX = vel;
p->MaxVelY = vel;
p->MaxVelZ = vel;
p->MaxVelA = vel;
p->MaxVelB = vel;
p->MaxVelC = vel;
p->CountsPerInchX = ctpin;
p->CountsPerInchY = ctpin;
p->CountsPerInchZ = ctpin;
p->CountsPerInchA = ctpin;
p->CountsPerInchB = ctpin;
p->CountsPerInchC = ctpin;
CM->SetAbort();
CM->ClearAbort();
CM->SetStraightTraverseCallback(StraightTraverseCallback);
CM->SetStraightFeedCallback(StraightFeedCallback);
CM->SetArcFeedCallback(ArcFeedCallback);
double Speed = 0.2; //inch/sec
double edge=0.2;
CM->StraightTraverse(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000); // jump back to zero
// set a bit, move in a circle, clear a bit
CM->DoKMotionBufCmd("SetBitBuf0");
CM->ArcFeed(Speed,CANON_PLANE_XY,0.0000, 0.5000, 0.0000, 0.2500,
DIR_CCW, 0.0000, 0.0000, 0.0000, 0.0000, 0, 0);
CM->ArcFeed(Speed,CANON_PLANE_XY,0.0000, 0.0000, 0.0000, 0.2500, DIR_CCW, 0.0000, 0.0000, 0.0000, 0.0000, 0, 0);
CM->DoKMotionBufCmd("ClearBitBuf0");
// move in an xy square (0,0) -> (0,0.5) -> (0.5,0.5) -> (0.5,0) -> (0,0)
//CM->StraightFeed(Speed, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0, 0);
//CM->StraightFeed(Speed, 0.5, 0.5, 0.0, 0.0, 0.0, 0.0, 0, 0);
//CM->StraightFeed(Speed, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0);
//CM->StraightFeed(Speed, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0);
CM->StraightFeed(Speed, 0.0,0.0,0.0, edge, 0.0, 0.0, 0, 0);
CM->StraightFeed(Speed, 0.0,0.0,edge, edge, 0.0, 0.0, 0, 0);
CM->StraightFeed(Speed, 0.0,0.0,edge, 0.0, 0.0, 0.0, 0, 0);
CM->StraightFeed(Speed, 0.0,0.0,0.0, 0.0, 0.0, 0.0, 0, 0);
// turn on a bit, wait 2 seconds, turn the bit off
CM->DoKMotionBufCmd("SetBitBuf0");
CM->Dwell(2);
CM->DoKMotionBufCmd("ClearBitBuf0");
CM->FlushSegments();
return 0;
}